package services

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
)

// GetSeaTempFileList
func GetSeaTempFileList() ([]string, error) {
	//获取海温文件列表
	//	http://cloud.oceanguide.org.cn/introduce.do?getNcFile
	//	productId:2c9080ac61644eb1016180a821f52926 ; currentPage:1
	//	post
	//	发送请求
	req, err := http.NewRequest("POST", "http://cloud.oceanguide.org.cn/introduce.do?getNcFile", strings.NewReader("productId=2c9080ac61644eb1016180a821f52926&currentPage=1"))
	if err != nil {
		return nil, err
	}
	//	设置请求头
	req.Header.Set("Content-Type", "application/json;charset=UTF-8")

	//	发送请求
	client := http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	//	获取响应体
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	//	解析json
	fmt.Println(string(body))

	return nil, nil
}
